package xq.pug.common.exception;

import lombok.Getter;
import xq.pug.common.exception.errorType.SystemErrorType;

/**
 * @author RenGaoshuai
 * @date 2023/7/6 14:10
 * @description
 */
@Getter
public class SystemException extends DefaultException {

    private Integer errCode;

    private String mesg;

    public SystemException(Integer errCode) {
        this.errCode = errCode;
        this.mesg = SystemErrorType.getMesg(errCode);
    }

    public SystemException(String mesg) {
        this.errCode = SystemErrorType.SYSTEM_ERROR.getCode();
        this.mesg = mesg;
    }

    public SystemException(Integer errCode, String mesg) {
        this.errCode = errCode;
        this.mesg = mesg;
    }

    public SystemException(SystemErrorType systemErrorType) {
        this.errCode = systemErrorType.getCode();
        this.mesg = systemErrorType.getMessage();
    }
}
